package LeedCode.IndexArray;

import java.util.Scanner;

public class Main {
    public int [] num;
    public  int  pivoIndex(int[] nums){
       int sumAll=0,temp=0;
        for (int x : nums) sumAll+=x;
        for (int sumleft=nums[temp];temp<nums.length-1;temp++){
            //排除数组中心索引index
            if ((sumleft+=nums[temp])*2==sumAll-nums[temp+1]){
                return temp+1;
            }
        }
            return 0;
    }
 /*   public static void main(String[] args){
        Main main = new Main();
        Scanner scanner = new Scanner(System.in);
        for (int x : main.num){
            x=scanner.nextInt();
            main.num[]=x;
        }
        System.out.println(main.pivoIndex([1,2,3,4,5,6,7]));
    }*/
}
